package com.cg.service.impl;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @ClassName MessageServiceImpl
 * @Description TODO
 * @Author CG
 * @Date 2023/12/13 11:06
 **/
@Component
public class MessageServiceImpl {

    @Value("${topicName}")
    private String topicName;

    @Resource
    private RocketMQTemplate rocketMQTemplate;


    public String sendMessage(String message){
        rocketMQTemplate.convertAndSend(topicName,message);
        return message;
    }
}
